package com.tyy.springboot;

import com.tyy.springboot.mapper.TestMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ApplicationContext;

@SpringBootApplication
public class Application implements CommandLineRunner {
    @Autowired
    private ApplicationContext context;

    public static void main(String[] args) {
        SpringApplication.run(Application.class, args);

    }

    @Override
    public void run(String... args) throws Exception {
        System.out.println("Hello World!");
        String applicationName = context.getApplicationName();
        System.out.println("Application Name: " + applicationName);
        TestMapper bean = context.getBean(TestMapper.class);
        System.out.println("TestMapper: " + bean);


    }
}
